﻿using com.nm.library.Excels;
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace VerticaAPI.Export
{
    [Export(typeof(ExcelImport))]
    public class DWStateSKC : ExcelImport
    {
        public override ExcelImportType Type => ExcelImportType.STATESKC;
        public override Dictionary<string, ImportVerify> DictFields => _dictFields;

        private static readonly Dictionary<string, ImportVerify> _dictFields = new List<ImportVerify> {
            new ImportVerify{ ColumnName="日期",FieldName="Stockdate",DataType=typeof(string),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
            new ImportVerify{ ColumnName="店铺",FieldName="ShopName",DataType=typeof(string),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
            new ImportVerify{ ColumnName="货号",FieldName="MaterialID",DataType=typeof(string),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
            new ImportVerify{ ColumnName="SKC畅滞销状态",FieldName="SKCCZPFlag" ,DataType=typeof(string),VerifyFunc=(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,100,false,false)},
           }.ToDictionary(e => e.ColumnName, e => e);


        public override object SaveImportData(DataTable dt, Dictionary<string, object> extraInfo, int userId)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// 获取导出的数据
        /// </summary>
        /// <param name="Keys">查询筛选条件</param>
        /// <returns>Datatable</returns>
        public override DataTable GetExportData(string Keys)
        {
            var db = new DWSuppleAllMessageHandler();
            return db.ExportStateSKC(Keys);
        }
    }
}
